package com.vikutorika.servlet;

import cn.hutool.json.JSONUtil;
import com.vikutorika.service.GroupChatService;
import com.vikutorika.util.ParamUtil;
import com.vikutorika.vo.PullMessageRequestVo;
import com.vikutorika.vo.ResultVo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/Chat")
public class ChatServlet extends BaseServlet {
    public void sendChat(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    }
    public void pullGroup(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException {
        PullMessageRequestVo pullMessageRequestVo = ParamUtil.paramToBean(req, PullMessageRequestVo.class);
        ResultVo result = GroupChatService.pull(pullMessageRequestVo);
        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().write(JSONUtil.toJsonStr(result));
    }
}
